class Solution
{
public:
    vector<int> successfulPairs(vector<int> &spells, vector<int> &potions, long long success)
    {
        sort(potions.begin(), potions.end());
        int n = spells.size();
        vector<int> result;
        for (int i = 0; i < n; ++i)
        {
            int spell = spells[i];
            long long threshold = ceil(success / static_cast<double>(spell));
            result.push_back(potions.end() - lower_bound(potions.begin(), potions.end(), threshold));
        }
        return result;
    }
};